package com.sky.dao;

import com.sky.annotation.Delete;
import com.sky.annotation.Insert;
import com.sky.annotation.Select;
import com.sky.annotation.Update;
import com.sky.domain.Dish;
import com.sky.domain.User;

import java.util.List;
import java.util.Map;

/**
 * @author chengjy
 * @date 2023/5/1
 */
public interface UserDao {
    /**
     * 新增用户
     */
    @Update("update user set sex = #{sex},phone = #{phone} where id = #{id}")
    void update(Map<String,Object> user);

    /**
     * 新增用户
     */
    @Update("update user set sex = #{sex},phone = #{phone} where id = #{id}")
    void update(User user);

    /**
     * 查询单条用户信息
     */
    @Select("select * from user where id = #{id}")
    User getById(Long id);

    /**
     * 查询单条菜品信息
     */
    @Select("select * from dish where id = #{id}")
    Dish getDishById(Long id);

    /**
     * 查询所有菜品信息
     */
    @Select("select * from dish")
    List<Dish> getDishList();
    /**
     * 测试根据id删除菜品
     */
    @Delete("delete from dish where id = #{id}")
    void deleteById(Long id);

    /**
     * 测试根据id删除菜品
     */
    @Update("update dish set name=#{name},price=#{price},status=#{status} where id = #{id}")
    void updateDishById(Dish dish);
}
